De acuerdo con la “gramática de los gráficos”, todo gráfico estadístico tiene tres componentes: 1. Datos (dataframe) 2. Mapeos de las columnas del dataframe a las propiedades isuales del gráfico (x, y, color, tamaño, forma, etc.) 3. Una o varias capas con geometrías (geom_point(), geom_bar(), geom_box())
library(DT)library(ggplot2)library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(leaflet)library(sf)
Linking to GEOS 3.9.3, GDAL 3.5.2, PROJ 8.2.1; sf_use_s2() is TRUE
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks plotly::filter(), stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggthemes)
Estadisticas_Policiales <- readxl::read_excel("C:/Users/DANIEL SARAVIA CRUZ/Downloads/estadsticaspoliciales2022.xlsx")Estadisticas_Policiales$Fecha <-as.Date(Estadisticas_Policiales$Fecha, format ="%Y-%m-%d")
Code
# Tabla interactiva del paquete DTEstadisticas_Policiales %>% dplyr::select(Delito, Fecha, Victima, Edad, Genero, Provincia, Canton) %>%mutate(Fecha =as.Date(Fecha, format ="%d/%m/%Y")) %>%datatable(options =list(pageLength =15,language =list(url ='//cdn.datatables.net/plug-ins/1.10.11/i18n/Spanish.json') ),colnames =c(# encabezados de las columnas"Delito","Fecha","Víctima","Edad","Género","Provincia","Cantón" ) )